home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / SAVESCRN.SWG / 0001_SAVE1.PAS.pas next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  54 lines

  1. { ----------------------------------- 1 -------------------------------- }
  2. {
  3. > Does anyone know of an easy way to remember the current screen and
  4. > then put back when a Program is finished?  What I mean is before the
  5. > Program clears the screen or Writes to it or whatever, to store the
  6. > current screen so that it can be restored to how it was before a Program
  7. > is run?
  8.  
  9.  Well you could try directly reading from memory and saving it into some kind
  10. of buffer like this...
  11. }
  12.  
  13. Var Buffer : Array[1..4000] of Byte;
  14.  
  15. Procedure Save_Screen;
  16. begin
  17.   Move(Mem[$B800:0000],Buffer,4000);
  18. end;
  19.  
  20. Procedure Restore_Screen;
  21. begin
  22.   Move(Buffer,Mem[$B800:0000],4000);
  23. end;
  24.  
  25. {
  26. You must save the screen in a 4K Array and then put it back when
  27. the Program is done.
  28. }
  29.  
  30.  
  31.  
  32. { ----------------------------------- 2 -------------------------------- }
  33. Type
  34.    AScreen = Array[1..4000] of Byte;
  35. Var
  36.    P : ^AScreen;    {Pointer to the Array}
  37.    Scr : AScreen;
  38.  
  39. Procedure SaveScreen;
  40. begin
  41.   P := Ptr($B800,$0); {Point to video memory}
  42.   Move(P^,Scr,4000);  {Move the screen into the Array}
  43. end;  {Run this proc at the beginning of the Program}
  44.  
  45. Procedure RestoreScreen;
  46. begin
  47.   Move(Scr,MEm[$B800 : 0], 4000); {Move the saved screen to video mem}
  48. end; {Call this at the end of your Program}
  49.  
  50. {
  51. This should do the job of saving the original screen and then restoring it when
  52. your Program is done
  53. }
  54.